import 'package:flutter/material.dart';
import 'package:flutter_public/flutter_public.dart';

/// FileName background_image_scaffold
///
/// @Author lax
/// @Date 2024/3/7
///
/// @Description

class BackgroundImageScaffold extends Container {
  static String? defaultImageName;

  BackgroundImageScaffold({
    super.key,
    Color? color,
    List<Color>? colors,
    String? imageName,
    String? imageUrl,
    BoxFit fit = BoxFit.cover,
    Alignment? alignment,
    PreferredSizeWidget? appBar,
    Widget? body,
    Widget? floatingActionButton,
    bool? resizeToAvoidBottomInset,
    Widget? bottomNavigationBar,
    Widget? bottomSheet,
    Widget? drawer,
    DrawerCallback? onDrawerChanged,
    Widget? endDrawer,
    DrawerCallback? onEndDrawerChanged,
  }) : super(
          decoration: AssetsImage.decoration(
            name: imageName ?? defaultImageName,
            url: imageUrl,
            fit: fit,
            alignment: alignment,
            gradient: LinearGradientDecoration.getLinearGradient(
              color: color,
              colors: colors,
              begin: Alignment.topCenter,
              end: Alignment.bottomCenter,
            ),
          ),
          child: Scaffold(
            backgroundColor: Colors.transparent,
            appBar: appBar,
            body: body,
            resizeToAvoidBottomInset: resizeToAvoidBottomInset,
            floatingActionButton: floatingActionButton,
            bottomNavigationBar: bottomNavigationBar,
            bottomSheet: bottomSheet,
            drawer: drawer,
            onDrawerChanged: onDrawerChanged,
            endDrawer: endDrawer,
            onEndDrawerChanged: onEndDrawerChanged,
          ),
        );
}
